<?
include("config.php");

$q = mssql_query("create view VMonKontrak as
WITH AX AS (SELECT MAX(seqno) AS nilai, NIK
FROM KarirPTSI GROUP BY NIK)
SELECT A.NIK, C.Nama, tgl_efektif, tgl_skd, tgl_selesai,
B.kode_so1, B.kode_so2, B.gol1,
B.gol2, B.no_surat, B.Jenis, B.stat_kar1, B.stat_kar2, B.jabatan1, B.jabatan2, 
B.fungsi1, B.fungsi2
FROM AX AS A 
INNER JOIN KarirPTSI AS B ON A.NIK = B.NIK AND A.nilai = B.seqno 
INNER JOIN Karyawan AS C ON A.NIK = C.NIK");
if($q){
	echo"Update View Monitoring Kontrak Pegawai OK, Thank You";
}
?>